package moodish.server;

import java.awt.EventQueue;

import javax.swing.JFrame;

import moodish.dummy.ServerCommDummy;

/**
 * The Class ServerGUI. This class is meant to run the server as an external
 * applet. Due to time constraints it's development is very rudimentary
 */
public class ServerGUI {

	/** The frame. */
	private JFrame frame;

	/**
	 * Launch the application.
	 * 
	 * @param args
	 *            the arguments
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {

					ServerGUI window = new ServerGUI();
					window.frame.setVisible(true);
					new Thread().run();

				} catch (Exception e) {
					System.out.println("GUI error");
				}
			}
		});
	}

	/**
	 * Create the application.
	 */
	public ServerGUI() {

		initialize();

	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	}

	/**
	 * Run.
	 */
	public void run() {
		ServerCommDummy serverComm = new ServerCommDummy();

		serverComm.start();
		Server server = new Server();

		server.start(serverComm);
	}

}
